package cc.customer.bigEmport.services.imp;

import cc.customer.bigEmport.damain.BigInten;
import cc.customer.bigEmport.services.BigInternServices;
import cc.customer.common.service.impl.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.ArrayList;
import java.util.List;

@Service
public class BigInternServicesImp extends BaseService<BigInten> implements BigInternServices {

    @Override
    public List<BigInten> getAllBigIntern(BigInten inten) {
        try {
            Example example = new Example(BigInten.class);
            Example.Criteria criteria = example.createCriteria();
            /**客户新增时间**/
            String starttime=  inten.getStarttime();
            String endtime = inten.getEndtime();

            if (!StringUtils.isAnyEmpty(starttime,endtime)){
                criteria.andBetween("cBginTime",starttime,endtime+" 23:59:59");

            }else if (!StringUtils.isEmpty(starttime)){
                criteria.andCondition("cBginTime = ",starttime);
            }
            example.setOrderByClause("c_bgin_time desc");
            List<BigInten> list = this.selectByExample(example);
            return list;
        }catch (Exception e){
            e.printStackTrace();
        }
        return new ArrayList<>();

    }
}
